﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 商场收银系统v2._2工厂And策略模式
{
    class CashContext
    {
        private  CashSuper _cs = null;

        public CashContext(string type)
        {
            switch (type)
            {
                case "正常收费":
                    _cs = new CashNormal();
                    break;

                case "打8折":
                    _cs = new CashRebate(0.8);
                    break;

                case "满300返100":
                    _cs = new CashReturn(300, 100);
                    break;
            }
        }

        public void Setting(CashSuper cs)
        {
            _cs = cs;
        }

        public double Payment(double money)
        {
            return _cs.Payment(money);
        }
    }
}
